﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using GrainManage.Server.Factory;
using GrainManage.Entities.Price;
using GrainManage.Server.Business;

namespace GrainManage.Server.Controllers
{
    public class PriceController : BaseController
    {
        private readonly PriceBusiness business = new PriceBusiness();

        public string Index()
        {
            return GetInfo(this, business);
        }
        public string Schema()
        {
            return GetSchema(this, business);
        }

        //************************************************POST************************************************
        [HttpPost]
        public ActionResult GetGrainType(InputGetGrainType input)
        {
            var result = business.GetGrainType(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetPriceType(InputGetPriceType input)
        {
            var result = business.GetPriceType(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetRecentPrice(InputGetRecentPrice input)
        {
            var result = business.GetRecentPrice(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult GetPrice(InputGetPrice input)
        {
            var result = business.GetPrice(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult Insert(InputInsert input)
        {
            var result = business.Insert(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult Update(InputUpdate input)
        {
            var result = business.Update(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult Delete(InputDelete input)
        {
            var result = business.Delete(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult BatchInsert(InputBatchInsert input)
        {
            var result = business.BatchInsert(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult BatchUpdate(InputBatchUpdate input)
        {
            var result = business.BatchUpdate(input);
            return Json(result);
        }

        [HttpPost]
        public ActionResult BatchDelete(InputBatchDelete input)
        {
            var result = business.BatchDelete(input);
            return Json(result);
        }
    }
}
